package ve.ejb.entity;

import ve.ejb.metadata.Comparator;
import java.io.Serializable;
import java.util.Collection;
import java.util.Date;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import ve.ejb.metadata.Color;

/**
 *
 * @author memozac
 */
@Entity
public class Pointer extends ScoreCard implements Serializable {
    private static final long serialVersionUID = 1L;

    @OneToMany private Collection<DimensionalCut> dimensionalCut;

    @ManyToMany(targetEntity=Color.class) @JoinTable(name="PointerComparator", joinColumns=@JoinColumn(name="idPointer"),
    inverseJoinColumns=@JoinColumn(name="idComparator")) private Collection<Comparator> comparators;

    @Temporal(value = TemporalType.TIMESTAMP) private Date registerDate;

    public Date getRegisterDate() {
        return registerDate;
    }

    public void setRegisterDate(Date registerDate) {
        this.registerDate = registerDate;
    }

    public Collection<Comparator> getComparators() {
        return comparators;
    }

    public void setComparators(Collection<Comparator> comparators) {
        this.comparators = comparators;
    }

    public Collection<DimensionalCut> getDimensionalCut() {
        return dimensionalCut;
    }

    public void setDimensionalCut(Collection<DimensionalCut> dimensionalCut) {
        this.dimensionalCut = dimensionalCut;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idScoreCard != null ? idScoreCard.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        if (!(object instanceof Pointer)) {
            return false;
        }
        Pointer other = (Pointer) object;
        if ((this.idScoreCard == null && other.idScoreCard != null) || (this.idScoreCard != null && !this.idScoreCard.equals(other.idScoreCard))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "ve.ejb.entity.Pointer[id=" + idScoreCard + "]";
    }

}//ends of class
